﻿using CTP.CRM.Repository.User.Entitys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CTP.CRM.Repository.User.Services
{
    /// <summary>
    /// 用户仓储
    /// </summary>
    public interface IUserRepository : ISimpleClient<UserEntity>
    {
        /// <summary>
        /// 添加信息到缓存中
        /// </summary>
        /// <returns></returns>
        Task<bool> AddCacheUserAsync();

        /// <summary>
        /// 从缓存中获取用户信息
        /// </summary>
        /// <returns></returns>
        Task<List<UserEntity>> GetCacheUserListAsync();

        /// <summary>
        /// 根据条件获取指定缓存集合
        /// </summary>
        /// <param name="match"></param>
        /// <returns></returns>
        Task<List<UserEntity>> GetCacheUserListAsync(Predicate<UserEntity> match);

        /// <summary>
        /// 根据条件获取指定单个实体
        /// </summary>
        /// <param name="match"></param>
        /// <returns></returns>
        Task<UserEntity> GetCacheUserEntityAsync(Predicate<UserEntity> match);

        /// <summary>
        /// 根据id查询用户
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task<UserEntity> GetUserById(int id);

        /// <summary>
        /// 新增用户
        /// </summary>
        /// <param name="userEntity"></param>
        /// <returns></returns>
        Task<int> AddUserAsync(UserEntity userEntity);

        /// <summary>
        /// 修改用户
        /// </summary>
        /// <param name="userEntity"></param>
        /// <returns></returns>
        Task<bool> EditUserAsync(UserEntity userEntity);

        /// <summary>
        /// 修改用户
        /// </summary>
        /// <param name="userEntity"></param>
        /// <returns></returns>
        Task<bool> EditUserWithPwdAsync(UserEntity userEntity);

        /// <summary>
        /// 判断集合数据是否全部存在
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        Task<bool> IsAllAsync(params int[] ids);

        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="userEntity"></param>
        /// <returns></returns>
        Task<bool> RemoveUserAsync(UserEntity userEntity);

        /// <summary>
        /// 修改所有信息
        /// </summary>
        /// <param name="userEntity"></param>
        /// <returns></returns>
        Task<bool> EditUserPassWordAsync(UserEntity userEntity);

       
    }
}
